package edu.scu.declaresys.service.impl;

import java.util.List;

import edu.scu.declaresys.dao.DAOFactory;
import edu.scu.declaresys.dao.intr.IMsgClassDAO;
import edu.scu.declaresys.dao.util.Depth;
import edu.scu.declaresys.exception.ExecuteException;
import edu.scu.declaresys.service.intr.IMsgClassService;
import edu.scu.declaresys.vo.MsgClass;

public class MsgClassServiceImpl implements IMsgClassService
{
	private IMsgClassDAO msgClassDao = DAOFactory.createMsgClassDAO();
	
	@Override
	public void deleteClass(Integer classId) throws ExecuteException
	{
		msgClassDao.delete(classId);
	}
	
	@Override
	public Integer addClass(MsgClass vo) throws ExecuteException
	{
		return msgClassDao.save(vo);
	}

	@Override
	public void modifyClass(MsgClass vo) throws ExecuteException
	{
		msgClassDao.update(vo, vo.getId());
	}
	
	@Override
	public List<MsgClass> findClassList() throws ExecuteException
	{
		return msgClassDao.findByProperty(null, null, Depth.ZERO, null, null, null, null);
	}
	
	@Override
	public MsgClass findClass(Integer classId) throws ExecuteException
	{
		return msgClassDao.findById(classId, Depth.ZERO);
	}

	@Override
	public MsgClass findClassByName(String className) throws ExecuteException
	{
		return msgClassDao.findByPropertyUnique(MsgClass.T_NAME, className, Depth.ZERO);
	}


	
}
